package com.ganbing518.trace.thread.executor;

import com.ganbing518.trace.common.log.context.TraceContext;
import com.ganbing518.trace.thread.TraceRunnable;

import java.util.concurrent.Executor;

/**
 * Description:
 *
 * @author gan bing
 * @version V1.0
 * @date 2018-06-15 15:06
 */
public class TraceExecutor implements Executor {

    private final Executor delegate;

    public TraceExecutor(Executor delegate) {
        this.delegate = delegate;
    }

    @Override
    public void execute(Runnable command) {
        this.delegate.execute(new TraceRunnable(command, TraceContext.getContextMap()));
    }
}
